﻿#region Header
// ------------------------ Licence / Copyright ------------------------
// 
// ScrumTable for Scrum Meeting Support
// Copyright © HSR - Hochschule für Technik Rapperswil
// All Rights Reserved
// 
// Author:
//  Michael Gfeller Silvan Gehrig Patrick Boos
// 
// ---------------------------------------------------------------------
#endregion

#region Usings

using System.Collections.Generic;

using log4net;
using log4net.Appender;

#endregion

namespace ScrumTable.Common.Logging
{
    /// <summary>
    /// Contains the assembly scoped utilities for the log4net framework.
    /// </summary>
    /// <remarks>
    /// The implementation of the current class follows the borg
    /// "pattern".
    /// </remarks>
    internal static class LoggerUtil
    {
        #region Declarations
        //--------------------------------------------------------------------
        // Declarations
        //--------------------------------------------------------------------

        #endregion

        #region Properties
        //--------------------------------------------------------------------
        // Properties
        //--------------------------------------------------------------------

        #endregion

        #region Methods
        //--------------------------------------------------------------------
        // Methods
        //--------------------------------------------------------------------

        internal static ICollection<string> GetFilesFromAppenders()
        {
            IList<IAppender> appenders = LogManager.GetRepository().GetAppenders();
            ICollection<string> logFiles = new List<string>(appenders.Count);

            foreach (IAppender appender in LogManager.GetRepository().GetAppenders()) 
            { 
                if (typeof(FileAppender).IsAssignableFrom(appender.GetType()))
                {
                    logFiles.Add(((FileAppender) appender).File);
                } 
            }
            return logFiles;
        } 

        #endregion
    }
}
